/*******************************************************************************
 * Copyright (c) 2009 Kevin Bierhoff and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Kevin Bierhoff - initial API and implementation
 *******************************************************************************/
package com.googlecode.twelfdevtools.server;

public class TwelfServerEvent {
	
	public enum TwelfServerEventType {
		RAW, OPEN, CLOSE, CONSTANT, PRAGMA
	}
	
	static TwelfServerEvent createRawLineEvent(String fileName, String rawLine) {
		TwelfServerEvent result = new TwelfServerEvent(TwelfServerEventType.RAW, rawLine);
		result.setFileName(fileName);
		return result;
	}
	
	static TwelfServerEvent createOpenFileEvent(String fileName) {
		TwelfServerEvent result = new TwelfServerEvent(TwelfServerEventType.OPEN, fileName);
		result.setFileName(fileName);
		return result;
	}
	
	static TwelfServerEvent createCloseFileEvent(String fileName) {
		TwelfServerEvent result = new TwelfServerEvent(TwelfServerEventType.CLOSE, fileName);
		result.setFileName(fileName);
		return result;
	}
	
	static TwelfServerEvent createConstantDefinitionEvent(String fileName,
			String constant) {
		TwelfServerEvent result = new TwelfServerEvent(TwelfServerEventType.CONSTANT, constant);
		result.setFileName(fileName);
		return result;
	}
	
	static TwelfServerEvent createPragmaEvent(String fileName,
			String pragma) {
		TwelfServerEvent result = new TwelfServerEvent(TwelfServerEventType.PRAGMA, pragma);
		result.setFileName(fileName);
		return result;
	}
	
	private final TwelfServerEventType type;
	private final String rawInfo;
	private String fileName;
	
	TwelfServerEvent(TwelfServerEventType type, String rawInfo) {
		this.type = type;
		this.rawInfo = rawInfo;
	}
	
	public TwelfServerEventType getEventType() {
		return type;
	}
	
	public String getRawInfo() {
		return rawInfo;
	}
	
	public String getFileName() {
		return fileName;
	}
	
	void setFileName(String fileName) {
		this.fileName = fileName;
	}

}
